package com.sc.mapper;

import java.io.IOException;

import org.apache.hadoop.io.FloatWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

/**
 * 
 * @Description TODO
 * @author pengjun
 * @version v1.0
 * @date 2020年7月9日
 * 
 */
public class StaffComouteMapper extends Mapper<LongWritable, Text, Text, FloatWritable> {

	Text outKeyName = new Text();
	FloatWritable outValue = new FloatWritable();
	
	@Override
	protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, FloatWritable>.Context context)
			throws IOException, InterruptedException {
		// TODO Auto-generated method stub
		String line = value.toString();
		String[] word = line.split("    ");
		outKeyName.set(word[0]);
		outValue.set(Float.parseFloat(word[3]));
		context.write(outKeyName, outValue);
	}
}
